package com.czy.fx.flake;

import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

import java.util.ArrayList;
import java.util.Arrays;

/********************************************************************
 * @brief
 * @version 0.1
 * @date 2024年12月29日 下午9:41
 * @author czy
 ********************************************************************/
public class Flake extends ImageView {
    //垂直速度
    private double vSpeed;
    //水平速度
    private double hSpeed;
    static final Image bigFlakeImage = new Image(Flake.class.getResource("/flake/big.png").toExternalForm());
    static final Image middleFlakeImage = new Image(Flake.class.getResource("/flake/middle.png").toExternalForm());
    static final Image smallFlakeImage = new Image(Flake.class.getResource("/flake/small.png").toExternalForm());
    private static final ArrayList<Image> images = new ArrayList<>(3);
    static {
        images.addAll(Arrays.asList(bigFlakeImage,middleFlakeImage,smallFlakeImage));
    }
    public Flake(Integer index) {
        super(images.get(index));
    }

    public double gethSpeed() {
        return hSpeed;
    }

    public void sethSpeed(double hSpeed) {
        this.hSpeed = hSpeed;
    }

    public double getvSpeed() {
        return vSpeed;
    }

    public void setvSpeed(double vSpeed) {
        this.vSpeed = vSpeed;
    }
}
